package com.example.video.entity;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import lombok.Data;

import java.util.List;

@lombok.Data
public class ResponseData {
    private int code;
    private boolean succ;
    private String msg;
    private Data data;

    // getters and setters
    @JsonIgnoreProperties(ignoreUnknown = true)
    @lombok.Data
    public static class Data {
        private String next_cursor;
        private boolean has_more;
        private List<Post> posts;
        private User user;
        private int overseas;

        @Override
        public String toString() {
            return "{" +
                    "\n\t\tnext_cursor = " +next_cursor +
                    "\n\t\thas_more = " + has_more +
                    "\n\t\toverseas = " + overseas +
                    "\n\t\tuser = " + user +
                    "\n\t\tposts = " + posts +
                    "\n\t}";
        }
        // getters and setters
    }
    @JsonIgnoreProperties(ignoreUnknown = true)
    @lombok.Data
    public static class Post {
        private String id;
//        private Long create_time;
        private String text;

        private List<Media> medias;


        @Override
        public String toString() {
            return "{" +
                    "\n\t\t\tid = " + id + '\'' +
//                    "\n\t\t\tcreate_time = " + create_time +
                    "\n\t\t\ttext = " + text + '\'' +
                    "\n\t\t\tmedias = " + medias +
                    "\n\t\t}";
        }

        // getters and setters
    }
    @JsonIgnoreProperties(ignoreUnknown = true)
    @lombok.Data
    public static class Media {
        private String media_type;
        private String resource_url;
        private String preview_url;
        private String preview_proxy_url;

        /*@Override
        public String toString() {
            return "{" +
                    "\n\t\t\t\tmedia_type = " + media_type +
                    "\n\t\t\t\tresource_url = " + resource_url +
                    "\n\t\t\t\tpreview_url = " + preview_url +
                    "\n\t\t\t\tpreview_proxy_url = " + preview_proxy_url +
                    "\n\t\t\t}";
        }*/
        @Override
        public String toString() {
            return "{" +
                    "\"media_type\":\"" + media_type +
                    "\",\"resource_url\":\"" + resource_url +
                    "\",\"preview_url\":" + (preview_url != null ? "\"" + preview_url + "\"" : null) +
                    ",\"preview_proxy_url\":" + (preview_proxy_url != null ? "\"" + preview_proxy_url + "\"" : null) +
                    "}";
        }
        // getters and setters
    }
    @JsonIgnoreProperties(ignoreUnknown = true)
    @lombok.Data
    public static class User {
        private String username;
        private String avatar;

        @Override
        public String toString() {
            return "{" +
                    "\n\t\t\tusername = " + username +
                    "\n\t\t\tavatar = " + avatar +
                    "\n\t\t}";
        }
        // getters and setters
    }

    @Override
    public String toString() {
        return "ResponseData{" +
                "\n\tcode = " + code +
                "\n\tsucc = " + succ +
                "\n\tdata = " + data +
                "\n}";
    }
}
